package com.honeyms.project.blog.blogfavoritesusercontent.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.honeyms.project.blog.blogfavoritesusercontent.mapper.BlogFavoritesUserContentMapper;
import com.honeyms.project.blog.blogcontentdetail.domain.BlogContentDetail;
import com.honeyms.project.blog.blogfavoritesusercontent.domain.BlogFavoritesUserContent;
import com.honeyms.project.blog.blogfavoritesusercontent.service.IBlogFavoritesUserContentService;
import com.honeyms.common.utils.text.Convert;

/**
 * 用户收藏帖子Service业务层处理
 * 
 * @author honeyms
 * @date 2020-10-16
 */
@Service
public class BlogFavoritesUserContentServiceImpl implements IBlogFavoritesUserContentService 
{
    @Autowired
    private BlogFavoritesUserContentMapper blogFavoritesUserContentMapper;

    /**
     * 查询用户收藏帖子
     * 
     * @param userId 用户收藏帖子ID
     * @return 用户收藏帖子
     */
    @Override
    public BlogFavoritesUserContent selectBlogFavoritesUserContentById(Long userId)
    {
        return blogFavoritesUserContentMapper.selectBlogFavoritesUserContentById(userId);
    }

    /**
     * 查询用户收藏帖子列表
     * 
     * @param blogFavoritesUserContent 用户收藏帖子
     * @return 用户收藏帖子
     */
    @Override
    public List<BlogFavoritesUserContent> selectBlogFavoritesUserContentList(BlogFavoritesUserContent blogFavoritesUserContent)
    {
        return blogFavoritesUserContentMapper.selectBlogFavoritesUserContentList(blogFavoritesUserContent);
    }
    
    /**
     * 查询用户收藏帖子列表
     * 
     * @param blogFavoritesUserContent 用户收藏帖子
     * @return 用户收藏帖子
     */
    @Override
    public List<BlogContentDetail> selectBlogContentDetailList(BlogFavoritesUserContent blogFavoritesUserContent)
    {
    	return blogFavoritesUserContentMapper.selectBlogContentDetailList(blogFavoritesUserContent);
    }

    /**
     * 新增用户收藏帖子
     * 
     * @param blogFavoritesUserContent 用户收藏帖子
     * @return 结果
     */
    @Override
    public int insertBlogFavoritesUserContent(BlogFavoritesUserContent blogFavoritesUserContent)
    {
        return blogFavoritesUserContentMapper.insertBlogFavoritesUserContent(blogFavoritesUserContent);
    }

    /**
     * 修改用户收藏帖子
     * 
     * @param blogFavoritesUserContent 用户收藏帖子
     * @return 结果
     */
    @Override
    public int updateBlogFavoritesUserContent(BlogFavoritesUserContent blogFavoritesUserContent)
    {
        return blogFavoritesUserContentMapper.updateBlogFavoritesUserContent(blogFavoritesUserContent);
    }

    /**
     * 删除用户收藏帖子对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBlogFavoritesUserContentByIds(String ids)
    {
        return blogFavoritesUserContentMapper.deleteBlogFavoritesUserContentByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户收藏帖子信息
     * 
     * @param userId 用户收藏帖子ID
     * @return 结果
     */
    @Override
    public int deleteBlogFavoritesUserContentById(Long userId)
    {
        return blogFavoritesUserContentMapper.deleteBlogFavoritesUserContentById(userId);
    }
    
    /**
     * 删除用户收藏帖子信息
     * 
     * @param userId 用户收藏帖子ID
     * @return 结果
     */
    @Override
    public int deleteBlogFavoritesUserContentById(Long userId,Long contentId)
    {
    	return blogFavoritesUserContentMapper.removeFavorites(userId, contentId);
    }
}
